package com.antbee.cms.ruili.spring.dao.hibernate;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;


import com.antbee.cms.ruili.hibernate.model.Baseinfo;
import com.antbee.cms.ruili.spring.dao.FirstPageDAO;
import com.antbee.cms.ruili.spring.dao.FirstPageEnDAO;
import com.antbee.cms.ruili.spring.dao.FirstPageJpDAO;

public class FirstPageJpDAOImpl extends HibernateDaoSupport implements
		FirstPageJpDAO {

	public Baseinfo getContract(String OperType) {
		// TODO Auto-generated method stub
		String sql ="from Baseinfo as a where a.type="+OperType;
		List Lsql = this.getHibernateTemplate().find(sql);
		if (Lsql.size() >=1){
			Baseinfo contract = (Baseinfo) Lsql.get(0);
			return contract;
		}
		return null;
	}

	public void UpdateContract(Baseinfo contract) {
		// TODO Auto-generated method stub
		this.getHibernateTemplate().saveOrUpdate(contract);
	}

	public List getAllBaseinfo() {
		// TODO Auto-generated method stub
        String sql = "from Baseinfo as a";
        List Lsql = this.getHibernateTemplate().find(sql);
        if (Lsql.size() >= 1){
        	return Lsql;
        }
		return null;
	}

}
